home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 412_01 / include / object.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-27  |  1.3 KB  |  51 lines

  1. #ifndef _OBJECT_H_
  2. #define _OBJECT_H_
  3.  
  4. #include <stdio.h>
  5.  
  6. /*
  7.                      VOBJECT_
  8.  
  9.     The abstract class VOBJECT_ is used by several other classes,
  10.     notably by container classes like LIST_ that stores (pointers to)
  11.     VOBJECT_ 's. Therefore, user-defined classes that make use of class
  12.     LIST_ need to derive their objects (that are to be stored in the list
  13.     object) from VOBJECT_. As a consequence these objects must implement
  14.     the virtual funcion equal().
  15.  
  16. */
  17.  
  18. class VOBJECT_
  19. {
  20.     public:
  21.         virtual ~VOBJECT_();
  22.         virtual int equal(const VOBJECT_ &) const = 0;
  23.         // returns 1 : objects are equal, or 0 : objects are not equal 
  24. };
  25.  
  26.  
  27.  
  28. /*
  29.          SVOBJECT_
  30.  
  31.     SVOBJECT_ is an extension of VOBJECT_, it is used by class
  32.     SORTEDLIST_ that creates a sorted list of (pointers to) SVOBJECT_.
  33.     Objects derived from SVOBJECT_ must implement at least function
  34.     eval() which is used to determine the order of two objects.
  35.  
  36. */
  37.  
  38. class SVOBJECT_ : public VOBJECT_    // sortable object
  39. {
  40.     public:
  41.     ~SVOBJECT_();
  42.     virtual int eval(const SVOBJECT_ &) const = 0;
  43.         // returns < 0 : object precedes other object 
  44.             // returns > 0 : object comes after other object  
  45.          // returns 0   : doesn't matter (objects rank equally high)  
  46. };
  47.  
  48. #endif
  49.  
  50.  
  51.